package com.helloandroid.tools

import android.view.View

abstract class ThrottleClickListener:View.OnClickListener {
    companion object{
        const val MIN_CLICK_DELAY_TIME = 500 //两个点击最小间隔
    }

     var lastClickTime: Long = 0
     override fun onClick(v: View?) {
         var curTime = System.currentTimeMillis()
         if (curTime - lastClickTime > MIN_CLICK_DELAY_TIME) { //只有大于才会走逻辑
             lastClickTime = curTime
             noDoubleClick(v)
         }
     }

     abstract fun noDoubleClick(v: View?)
 }